using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
	public partial class MessagePushMap
		: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<MessagePush> {
		public MessagePushMap() {
			// table
			ToTable("mc_MessagePush", "dbo");

			// keys
			HasKey(t => t.Id);

			// Properties
			Property(t => t.Id)
				.HasColumnName("Id")
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
				.IsRequired();
			Property(t => t.MerchantId)
				.HasColumnName("MerchantId")
				.IsRequired();
			Property(t => t.Title)
				.HasColumnName("Title")
				.HasMaxLength(100)
				.IsRequired();
			Property(t => t.Content)
				.HasColumnName("Content")
				.IsRequired();
			Property(t => t.ShortContent)
				.HasColumnName("ShortContent")
				.HasMaxLength(255)
				.IsRequired();
			Property(t => t.CreateTime)
				.HasColumnName("CreateTime")
				.IsRequired();
			Property(t => t.Type)
				.HasColumnName("Type")
				.IsRequired();
			Property(t => t.ObjectId)
				.HasColumnName("ObjectId")
				.IsOptional();
			Property(t => t.ReadTime)
				.HasColumnName("ReadTime")
				.IsOptional();
			Property(t => t.IsRead)
				.HasColumnName("IsRead")
				.IsRequired();

			// Relationships
			HasRequired(t => t.Merchant)
				.WithMany()
				.HasForeignKey(d => d.MerchantId)
				.WillCascadeOnDelete(false);
		}
	}
}
